package com.lbn.monitor.app;

import android.util.Log;

import com.free.framework.business.NetSubscriber;
import com.google.gson.Gson;
import com.lbn.monitor.api.AppHost;
import com.lbn.monitor.api.model.Pollutant;
import com.lbn.monitor.base.AppBasePresenter;

import java.util.List;

/**
 * @author 李炳南
 * @date 2017/3/6
 */
public class MainPresenter extends AppBasePresenter<IMainView> {


    private static final String TAG = "MainPresenter";
    public void pollutants(){
       subscribeNetwork(AppHost.getApi().pollutants(), new NetSubscriber<List<Pollutant>>(getView(),false) {
           @Override
           public void onNext(List<Pollutant> o) {
               Log.e(TAG,"Pollutant = "+new Gson().toJson(o));
               getView().onPollutants(o);
           }
       });
    }


}
